package com.flowerplus.store.common.structure.ui.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.flowerplus.store.R;
import com.flowerplus.store.common.structure.ui.control.AppToolbar;


/**
 * Created by z on.
 * Des:
 * Date: 2017/3/10
 */

public abstract class ToolbrFragment extends LoadingFragment {

    protected AppToolbar mToolbar;

    @Override
    public int initContentView() {
        return R.layout.activity_apptoolbar;
    }


    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mToolbar =  findViewById(R.id.toolbar);
        initToolbar();
    }

    protected void initToolbar() {
        mToolbar.setTitleTextColor(Color.WHITE);
        mToolbar.setBackOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });

    }

    protected void setToolbarNext(String text, View.OnClickListener listener) {

        mToolbar.setNextText(text);
        mToolbar.setNextOnClickListener(listener);

    }

    protected void setToolbarNext(View.OnClickListener listener) {
        mToolbar.setNextOnClickListener(listener);

    }

    protected void setToolbarNext(String text) {
        mToolbar.setNextText(text);
    }

    public void setToolbarTitle(String title) {
        mToolbar.setTitle(title);
    }
}
